package com.itheima.service.db.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itheima.domain.PmsSkuStock;
import com.itheima.mapper.PmsSkuStockMapper;
import com.itheima.service.db.PmsSkuStockService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class PmsSkuStockServiceImpl implements PmsSkuStockService {

    @Autowired
    PmsSkuStockMapper pmsSkuStockMapper;

    @Override
    public List<PmsSkuStock> findSkuStockByInfo(Integer pid, String keyword) {
        LambdaQueryWrapper<PmsSkuStock>lqw=new LambdaQueryWrapper<>();
        lqw.eq(PmsSkuStock::getProductId,pid)
                .like(StrUtil.isNotBlank(keyword),PmsSkuStock::getSkuCode,keyword);
        List<PmsSkuStock> pmsSkuStocks = pmsSkuStockMapper.selectList(lqw);
        return pmsSkuStocks;

    }
}
